﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using EHTWebsiteProject.Code.Entity;

namespace EHTWebsiteProject.Controls
{
    public partial class CartControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ShoppingCart.Instance.GetSubTotal() == 0)
                {
                    ltrTotal.Text = "";
                }
                else
                {
                    ltrTotal.Text = "Totalpris:" + ShoppingCart.Instance.GetSubTotal().ToString("C");
                }
                BindData();
            }
        }

        /// <summary>
        /// lay du lieu trong gio hang
        /// </summary>
        protected void BindData()
        {
            gvShoppingCartSum.DataSource = ShoppingCart.Instance.Items;
            gvShoppingCartSum.DataBind();

        }

    }
}